package com.jiyi.activity.main;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiyi.activity.iot.FireAlarmActivity;
import com.swift.maintenance.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/4/26.
 */

public class MainIotFragment extends Fragment {
    @BindView(R.id.tvBack)
    TextView tvBack;
    @BindView(R.id.tvTitle)
    TextView tvTitle;
    @BindView(R.id.tvSearch)
    TextView tvSearch;
    @BindView(R.id.ivHint)
    ImageView ivHint;
    @BindView(R.id.top_layout)
    RelativeLayout topLayout;
    @BindView(R.id.llFire)
    LinearLayout llFire;
    @BindView(R.id.llGuZhang)
    LinearLayout llGuZhang;
    @BindView(R.id.llTest)
    LinearLayout llTest;

    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main_ioc, null, false);
        ButterKnife.bind(this, view);
        init();
        return view;
    }

    void init() {
        setTop();
    }

    void setTop() {
        tvBack.setVisibility(View.INVISIBLE);
        tvTitle.setText("消防物联");
        tvSearch.setVisibility(View.INVISIBLE);
    }


    @OnClick({R.id.llFire, R.id.llGuZhang, R.id.llTest})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.llFire:
                intent = new Intent(getContext(), FireAlarmActivity.class);
                intent.putExtra("type",1);
                startActivity(intent);
                break;
            case R.id.llGuZhang:
                intent = new Intent(getContext(), FireAlarmActivity.class);
                intent.putExtra("type",2);
                startActivity(intent);
                break;
            case R.id.llTest:
                intent = new Intent(getContext(), FireAlarmActivity.class);
                intent.putExtra("type",3);
                startActivity(intent);
                break;
        }
    }
}
